import pdfortable.logic.LogicPage;

public class Example {

  public static void main(String[] args) {
    //创建PdforTable对象
    PdforTable pdforTable = new PdforTable();

    //待抽取的PDF文件路径
    String pdfPath = "C:\\Users\\测试数据源-2页.pdf";
    //保存抽取结果的Excel文件路径(程序根据该路径自动创建文件)
    String excelPath = "C:\\Users\\export.xls";

    //示例1：抽取PDF表格到LogicPage对象
    //LogicPage logicPage = pdforTable.extractTable(pdfPath);

    //示例2：按页抽取PDF表格到LogicPage对象
    LogicPage logicPage = pdforTable.extractTable(pdfPath,1,1);
    logicPage.getLogicRowList().forEach(logicRow -> {
      System.out.print("第" + logicRow.getRowIndex() + "行");
      System.out.print("[");
      logicRow.getLogicCellList().forEach(logicCell -> {
        System.out.print(logicCell.getText() + ",");
      });
      System.out.println("]");
    });

    //示例3：抽取PDF表格到Excel
    //pdforTable.convertPdfToExcel(pdfPath, excelPath);

    //示例4：按页抽取PDF表格Excel
    //pdforTable.convertPdfToExcel(pdfPath, excelPath, 1, 1);

  }
}
